from api.base import BaseBuyerApi
from common.encry_decry import md5
from common.file_load import read_yml


class BuyerLoginAPI(BaseBuyerApi):

    def __init__(self,username, password):
        """登录接口"""
        super().__init__() # 继承父类属性
        # self.session = requests.session()
        self.url = f"{self.host}/passport/login"
        self.method = "post"
        self.data = {
            "username": username,
            "password": md5(password),
            "captcha": read_yml("/config/common.yml")["captcha"],
            "uuid": "jdajhjakd"
        }

    # def send_request(self):
        # self.resp = self.session.request(url=self.url, data=self.data,method=self.method)
        # return self.resp

if __name__ == '__main__':
    resp = BuyerLoginAPI().request()
    print(resp.status_code)
    print(resp.text)